<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function anchor_image($uri = '', $title = '', $attributes = '')
{
	if ( ! is_array($uri))
	{
		$site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
	}
	else
	{
		$site_url = site_url($uri);
	}
	
	if ($title == '')
	{
		$title = $site_url;
	}

	return '<a href="'.$site_url.'"'.$attributes.'>'.$title.'</a>';
}
	

# /usr/share/icons/Tangerine/32x32
# /var/www/img/icon/32x32/emblems
# /var/www/img/icon/32x32/devices/camera-photo.png

function anchor_icon($uri, $image, $title = FALSE)
{
    $site_url = site_url($uri);
    $dir  = rstrstr($image, '/');

    if($title === FALSE){
        $title = ucwords($image); // Upper case words
        $title = str_replace('_',' ', $title);
        $title = str_replace('-',' ', $title);
    }
	$img = '<img src="/img/icon/'.$image.'.png" width="30" alt="'.$title.'" title="'.$title.'" />';
    return '<a href="'.$site_url.'">'.$img.'</a>';
}



?>
